PHP fgets () function is used to read a row from the file pointer, the function can be combined with the feof function to read the contents of the file, this article to share with you PHP use Fgets () read/Get the file content of a simple example
Use the PHP function fgets to read pointer files. PHP function fgets -- read a line from the file pointer. stringfgets (inthandle [, intlength]) reads a line from the file pointed to by handle and returns a line with a maximum length of-1
PHP function Fgets--reading a line from the file pointerstring fgets (int handle [, int length])
Reads a row from the file pointed to by handle and returns a string of up to length-1 bytes in length. Stop after encountering a newline character
In the PHP language, there are many powerful functions that support the language's continuous development, and the pie allows more and more programmers to start choosing the language. PHP function fgets is one of the powerful functions.
PHP
(1) fgets:
Header file
Include
Define functions
Char * fgets (char * s, int size, FILE * stream );
Function Description
Fgets () is used to read characters from
Php
the Fgets () function reads a row from the file pointer.
its syntax is:
Fgets (File,length)
Parameters
Description
File
Necessary. Specifies the file to be read.
Length
Optional. Specifies the
1. Prototype declaration: Char *strcpy (char* dest, const char *SRC);Header files: #include and #include Function: Copy a string that starts from the SRC address and contains a null terminator to the address space starting with destDescription: The
Standard I/O Library
The standard I/O Library and its header files provide a 10 thousand interface called by the underlying I/O system. this library is not part of ANSI Standard C, and the system call we mentioned earlier is not. However, this
1, with MySQL-relatedMysql_connectEstablish a connection to the MySQL serverGrammarResource mysql_connect (String server[,string usingname[,string password[, BOOL New_link[,int Client_flags]]]eg
Copy Code code as follows:
$DB _host = "
Most buffer overflow problems in C can be traced directly to the standard C library. The worst culprits are problematic string operations (strcpy, Strcat, sprintf, and get) that do not perform self-variable checks. In general, strict rules such as
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.